package com.example.anew.journey.mynewjourney.logic.setPassword;

import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.widget.Toast;

import com.example.anew.journey.mynewjourney.R;
import com.example.anew.journey.mynewjourney.base.BaseRegisteredSetActivity;
import com.example.anew.journey.mynewjourney.firstchangelogic.FirstChangeMain.FirstChangeMainActivity;
import com.example.anew.journey.mynewjourney.logic.setPassword.persenter.SetPasswordPersenter;
import com.example.anew.journey.mynewjourney.logic.setPassword.view.ISSetPasswordView;

import java.util.HashMap;
import java.util.Map;

import butterknife.ButterKnife;
import cn.jesse.nativelogger.NLogger;

/**
 * 杭州惟君医疗科技有限公司15
 * Created by 20433 on 2018/3/5
 */

public class SetPasswordActivity extends BaseRegisteredSetActivity implements ISSetPasswordView {

    private String phone;
    private String version_code;
    private String niname;
    private SetPasswordPersenter mSetPasswordPersenter = new SetPasswordPersenter(this);
    private Map<String, String> map;

    /**
     * @desc 点击下一步
     * */
    @Override
    protected void onClickBtNext() {
        mSetPasswordPersenter.userRegistration(this);
    }
    /**
     * @desc 点击Button的内容
     * */
    @Override
    protected String setNext() {
        return "确定";
    }
    /**
     * @desc 点击Button的大小
     * */
    @Override
    protected int setNextSize() {
        return 16;
    }
    /**
     * @desc 点击Button的背景
     * */
    @Override
    protected Drawable setNextBg() {
        return getResources().getDrawable(R.drawable.registered_or_login_bt_get_verification_code);
    }
    /**
     * @desc 设置Title名称
     * */
    @Override
    protected String setTitleName() {
        return "设置密码";
    }
    /**
     * @desc 设置介绍内容
     * */
    @Override
    protected String setIntroduce() {
        return "至少6个字符哦";
    }
    /**
     * @desc 获取输入的内容
     * */
    @Override
    protected void getEtContent(String trim) {

    }
    /**
     * @desc 设置Title名称颜色
     * */
    @Override
    protected int setTitleNameColor() {
        return 0xff333333;
    }
    /**
     * @desc 设置Title名称字体大小
     * */
    @Override
    protected int setTitleNameSize() {
        return 20;
    }
    /**
     * @desc 设置介绍内容颜色
     * */
    @Override
    protected int setIntroduceColor() {
        return 0xff999999;
    }
    /**
     * @desc 设置介绍内容字体大小
     * */
    @Override
    protected int setIntroduceSize() {
        return 14;
    }
    /**
     * @desc 点击返回按钮
     * */
    @Override
    protected void onClickReturn() {
        finish();
    }
    /**
     * @desc 设置EditText提示
     * */
    @Override
    protected String setEtContentHint() {
        return "请输入你的密码";
    }
//    /**
//     * @desc 设置EditText输入类型
//     * */
//    @Override
//    protected int setEtContentInputType() {
//        return 0;
//    }
public String third_party_login_id;
    public String third_party_login_name;
    public String third_party_login_state;
    /**
     * @desc 初始化数据
     * */
    @Override
    protected void initDate() {
        Intent intent = getIntent();
        phone = intent.getStringExtra("phone");
        version_code = intent.getStringExtra("version_code");
        niname = intent.getStringExtra("niname");
        NLogger.e("TAG","=========state==niname========" + niname);
        NLogger.e("TAG","=========state==version_code========" + version_code);
        NLogger.e("TAG","=========state==phone========" + phone);

        third_party_login_id = intent.getStringExtra("third_party_login_id");
        third_party_login_name = intent.getStringExtra("third_party_login_name");
        third_party_login_state = intent.getStringExtra("third_party_login_state");
        NLogger.e("TAG","=========state=====1021===="+third_party_login_id);
        NLogger.e("TAG","=========state=====1022===="+third_party_login_name);
        NLogger.e("TAG","=========state=====100203===="+third_party_login_state);


    }
    // 显示提示Toast信息
    @Override
    public void showToastInformation(String str) {
        Toast.makeText(SetPasswordActivity.this,str,Toast.LENGTH_SHORT).show();
    }
    // 获取输入的密码
    @Override
    public String getInputPassWord() {
        return set_et_content.getText().toString().trim();
    }
    // 设置输入的密码
    @Override
    public void setInputPassWord() {

    }
    // 跳转到主页
    @Override
    public void toMainActivity() {
        Intent intent =   new Intent(SetPasswordActivity.this, FirstChangeMainActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
        startActivity(intent);
    }
    // 显示进度
    @Override
    public void displayProgress() {

    }
    // 隐藏进度
    @Override
    public void hiddenProgress() {

    }
    // 携带注册信息
    @Override
    public Map<String, String> carryRegistrationInformation() {
        map = new HashMap();
        map.put("phone",phone);
        map.put("version_code",version_code);
        map.put("niname",niname);
        map.put("password",getInputPassWord());
        NLogger.e("TAG","=========state=====1024===="+third_party_login_id);
        NLogger.e("TAG","=========state=====1025===="+third_party_login_name);
        NLogger.e("TAG","=========state=====10026===="+third_party_login_state);
        return map;
    }

    @Override
    public String getThirdPartyLoginID() {
        return third_party_login_id;
    }

    @Override
    public String getThirdPartyLoginNAME() {
        return third_party_login_name;
    }

    @Override
    public String getThirdPartyLoginSTATE() {
        return third_party_login_state;
    }

    /**
     * @desc Activity 销毁 释放资源
     */
    @Override
    protected void releaseResources() {
        ButterKnife.unbind(this);
    }

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        NLogger.e("TAG","=========222=fgcj===========");
    }
}
